
<?php

$time = time();
$key = \common\helper\HashHelper::getUploadHash($time);

?>
<?php $this->beginBlock('css');?>
<link rel="stylesheet" type="text/css" href="<?=Yii::getAlias('@static')?>/pc/liketry/css/user.css">
<?php $this->endBlock();?>

<?= $this->render('@liketry/views/layouts/header_goods.php',['top_ad_show'=>false])?>
<!-- 主体内容 Start -->
<div class="usermain comments-add">
	<div class="add-top">	
		<div class="img"><img src="<?=$data['img']?>" /></div>
		<div class="mes">
			<h1><?= $data['goods_name']?></h1>
			<p>¥<?= $data['order_amount']?>+<?= $data['try_coin']?>试豆</p>
			<div class="score" size="0" id="score">
				<span>评分：</span>
				<a class="icon icon-start"></a>
				<a class="icon icon-start"></a>
				<a class="icon icon-start"></a>
				<a class="icon icon-start"></a>
				<a class="icon icon-start"></a>
			</div>
		</div>
	</div>
	<div class="add-content">
		<p class="title"><span>自爆照片</span></p>
		<div class="upload-photos">
			<div class="left">
				<p class="view-img" >
					<a id="imgFile">浏览</a>
					<input type="text" id="fileName" class="img-name" value="" readonly />
				</p>
				<p>支持jpg,JPG,jpeg,gif,GIF,png,PNG,bmp,BMP格式，上传图片最大为1M</p>
				<a class="upload-btn" id="upImage">上传图片</a>
			</div>
			<div class="right" id="imageArea">
				<span></span>
				<span></span>
				<span></span>
				<span></span>
			</div>
		</div>
		<p class="title"><span>心得评论</span></p>
		<div class="write-content">
			<textarea cols="30" rows="10" id="content" name="content">记录您真实的使用后心得感受，写下它的优点。</textarea>
			<p class="error" id="error">您的心得需超过20字，不可使用全符号/全英文/全数字，汉字至少10个。</p>
			<a class="grey" id="commentsSubmit">提交评论</a>
		</div>
	</div>
</div>
<!-- 主体内容 End -->

<?php $this->beginBlock('js');?>
<script src="<?=Yii::getAlias('@static')?>/pc/common/js/jquery-1.12.3.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/pc/common/js/webuploader.min.js"></script>
<script src="<?=Yii::getAlias('@static')?>/pc/common/js/lkt.pc.js"></script>
<script src="<?=Yii::getAlias('@static')?>/pc/liketry/js/comments-add.js"></script>
<script>
	var orderId = "<?= $data['order_id']?>";
	var goodsId = "<?= $data['goods_id']?>";
	var upImageUrl = "<?= common\helper\UrlManager::createUrl(Yii::$app->params['domains']['upload'],['upload/webupload','time'=>$time,'key'=>$key])?>";
	var commentsAddUrl = "<?=Yii::$app->urlManager->createUrl(Yii::$app->controller->id . '/create')?>";
	var orderDetailUrl = "<?=Yii::$app->urlManager->createUrl(["order-details/order-detail", 'order_info_id'=>$data['order_id']]);?>";
	var uploader = WebUploader.create({
		auto: false,
		swf: '<?=Yii::getAlias('@static')?>/pc/common/js/Uploader.swf',
		server: upImageUrl,
		pick: '#imgFile',
		fileVal: "upfile",
		threads: 1,
		accept: {
			title: 'Images',
			extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/*'
		},
		compress: {
			width: 600,
			height: 600,
			quality: 60,
			allowMagnify: false,
			crop: false,
			preserveHeaders: true,
			noCompressIfLarger: false,
			 compressSize: 1048576
		}
	});
</script>
<?php $this->endBlock();?>

